#https://www.luogu.com.cn/problem/P1008

N = 9
Criteria=[1,2,3,4,5,6,7,8,9]
def Integer.digits()
	res=[]
	i=self 
	while i !=0
		res << i % 10
		i/=10
	end
	return res.reverse
end

for a in (101..999)
	b=2*a
	c=3*a
	
	if (a.digits + (b.digits) + (c.digits) ).sort ==Criteria
		puts "#{a} #{b} #{c}"
	end
end


# Nums = (1..9).to_a

# def fact(x)
# 	(1..x).reduce(:*)
# end

# class Permutation

# 	def initialize(num)
# 		@iter=0;
# 		@Scale=num
# 		@Limit=fact(num)
# 	end
# 	def get_array_from_num(seq)
# 		res=[]
# 		nums=(1..@Scale).to_a
# 		rg=(2..@Scale).to_a.reverse
# 		rg.each do |i|
# 			res<<nums.delete_at(seq % i)
# 			seq/=i
# 		end
# 		res<<nums[0]
# 		return res;
# 	end
# 	def each()
# 		while(@iter <@Limit)
# 			@iter+=1
# 			yield get_array_from_num(@iter)
# 			@iter+=1
# 		end
# 		return
# 	end
# 	include Enumerable
# end



#permutation=Permutation.new(9)

# def array_to_num(arr)
# 	return arr[0]*100+arr[1]*10 + arr[2],
# 	arr[3]*100+arr[4]*10 + arr[5],
# 	arr[6]*100+arr[7]*10 + arr[8]
# end

# permutation.each{ |permu|
# 	a,b,c=array_to_num(permu)
# 	if  b==2*a && c==3*a 
# 		puts "#{a} #{b} #{c}"
# 	end 
# }